import java.text.ParseException
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
 //Bill的类
class Bill {
    String date;
    double amount;
    String category;
    String note;
    boolean isIncome; // true for income, false for expense
 
    public Bill(String date, double amount, String category, String note, boolean isIncome) {
        this.date = date;
        this.amount = amount;
        this.category = category;
        this.note = note;
        this.isIncome = isIncome;
    }
 
    @Override
    public String toString() {
        return "Date: " + date + ", Amount: " + amount + ", Category: " + category + ", Note: " + note + (isIncome ? " (Income)" : " (Expense)");
    }
}
 
public class PersonalFinanceManager {
    private List<Bill> bills = new ArrayList<>();
    private double monthlyBudget;
    private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
 
    public void addIncome(String date, double amount, String category, String note) throws ParseException {
        bills.add(new Bill(date, amount, category, note, true));
    }
 
    public void addExpense(String date, double amount, String category, String note) throws ParseException {
        bills.add(new Bill(date, amount, category, note, false));
    }
 
    public void displayBills() {
        System.out.println("Income Bills:");
        for (Bill bill : bills) {
            if (bill.isIncome) {
                System.out.println(bill);
            }
        }
        System.out.println("\nExpense Bills:");
        for (Bill bill : bills) {
            if (!bill.isIncome) {
                System.out.println(bill);
            }
        }
    }
 